#include <iostream>
#include <vector>
#include <sstream>
#include <cctype>
using namespace std;
vector<string> split(const string &s, char d) {
    vector<string> a;
    string b;
    stringstream ss(s);
    while (getline(ss, b, d)) {
        a.push_back(b);
    }
    return a;
}
string q(const string &a) {
    string b="";
    for (int i= 0; i < a.length(); i++) {
        if (not(isalnum(a[i]))){
            b += ' ';
        }
        else{ b += a[i]; }
    }
    return b;
}
int main(){
    char a[4096]={};
    cin.getline(a,4096);
    string A(a);
    A = q(A);
    int ans=0;
    string answ;
    vector<string> p=split(A,' ');
    for (size_t i=0;i<p.size();i++){
        if (p[i].length()>ans){ ans = p[i].length(); answ = p[i]; }
    }
    cout << answ << " " << ans << endl;
}
